<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增网点员工列表')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-shopUser-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">网点名称：</label>
                <div class="col-sm-5">
                    <select name="shopId" class="form-control m-b">
                        <option th:each="shop : ${shopList}" th:text="${shop.shopName}" th:value="${shop.shopId}"></option>
                    </select>
                </div>
                <div class="col-sm-4"></div>
            </div>

                <div class="form-group">
                    <label class="control-label col-sm-3">管理员姓名：</label>
                    <div class=" col-sm-5">
                        <input type="text" class="form-control" placeholder="请输入管理员姓名"
                               id="userName" name="userName"  required
                               datatype="*" nullmsg="管理员姓名不能为空">
                    </div>
                    <div class="col-sm-4"></div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-3">管理员手机号：</label>
                    <div class=" col-sm-5">
                        <input type="tel" class="form-control" placeholder="请输入管理员手机号"
                               id="phonenumber" name="phonenumber" required
                               datatype="m" nullmsg="管理员手机号不能为空">
                    </div>
                    <div class="col-sm-4"></div>
                </div>


        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">

        var prefix = ctx + "core/shopUser"

        //表单校验
        $("#form-shopUser-add").validate({
            focusCleanup: true,
            rules : {
                phonenumber : {
                    isPhone:true,
                    remote : {
                        url: prefix+"/testPhone",
                        type:"POST",
                        data:{
                            phone:function () {
                                return $("#phonenumber").val();
                            }
                        }
                    }
                }
            },
            messages : {
                phonenumber: {
                    isPhone: "请填写正确的手机号码",
                    remote : "该号码已存在"
                }
            }
        })



        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-shopUser-add').serialize());
            }
        }
    </script>
</body>
</html>